package com.visizen.wisdomclass.server.client;

import com.visizen.wisdomclass.server.model.WcImage;
import com.visizen.wisdomclass.server.model.WcImageExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface WcImageMapper {
    @SelectProvider(type=WcImageSqlProvider.class, method="countByExample")
    int countByExample(WcImageExample example);

    @DeleteProvider(type=WcImageSqlProvider.class, method="deleteByExample")
    int deleteByExample(WcImageExample example);

    @Delete({
        "delete from wc_image",
        "where IMAGE_ID = #{IMAGE_ID,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long IMAGE_ID);

    @Insert({
        "insert into wc_image (IMAGE_ID, PHOTO_ID, ",
        "ATTACH_ID, USER_ID)",
        "values (#{IMAGE_ID,jdbcType=BIGINT}, #{PHOTO_ID,jdbcType=BIGINT}, ",
        "#{ATTACH_ID,jdbcType=BIGINT}, #{USER_ID,jdbcType=VARCHAR})"
    })
    int insert(WcImage record);

    @InsertProvider(type=WcImageSqlProvider.class, method="insertSelective")
    int insertSelective(WcImage record);

    @SelectProvider(type=WcImageSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="IMAGE_ID", property="IMAGE_ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="PHOTO_ID", property="PHOTO_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="ATTACH_ID", property="ATTACH_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="USER_ID", property="USER_ID", jdbcType=JdbcType.VARCHAR)
    })
    List<WcImage> selectByExample(WcImageExample example);

    @Select({
        "select",
        "IMAGE_ID, PHOTO_ID, ATTACH_ID, USER_ID",
        "from wc_image",
        "where IMAGE_ID = #{IMAGE_ID,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="IMAGE_ID", property="IMAGE_ID", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="PHOTO_ID", property="PHOTO_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="ATTACH_ID", property="ATTACH_ID", jdbcType=JdbcType.BIGINT),
        @Result(column="USER_ID", property="USER_ID", jdbcType=JdbcType.VARCHAR)
    })
    WcImage selectByPrimaryKey(Long IMAGE_ID);

    @UpdateProvider(type=WcImageSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") WcImage record, @Param("example") WcImageExample example);

    @UpdateProvider(type=WcImageSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") WcImage record, @Param("example") WcImageExample example);

    @UpdateProvider(type=WcImageSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(WcImage record);

    @Update({
        "update wc_image",
        "set PHOTO_ID = #{PHOTO_ID,jdbcType=BIGINT},",
          "ATTACH_ID = #{ATTACH_ID,jdbcType=BIGINT},",
          "USER_ID = #{USER_ID,jdbcType=VARCHAR}",
        "where IMAGE_ID = #{IMAGE_ID,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(WcImage record);
}